﻿//===============================================================================
// La Pomme d'Or Krystal Application
// Windows Presentation Foundation Composite Application 
//===============================================================================
// Copyright (c) Jérôme Piquot.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================


using System;
using System.ComponentModel;

namespace PJ.Data
{
    /// <summary>
    /// Object data interface
    /// </summary>
    public interface IObjectData : IDataErrorInfo 
    {
        /// <summary>
        /// Cached date time
        /// </summary>
        /// <exception cref="Exception">Only <see langref="null"/> <paramref name="CachedDate"/> can be changed</exception>
        DateTime? CachedDate
        {
            get;
            set;
        }

        /// <summary>
        /// Global unique Id
        /// </summary>
        /// <remarks>Must be unique in application scope</remarks>
        /// <exception cref="Exception">Only <see langref="null"/> or empty <paramref cref="GlobalId"/> can be changed</exception>
        string GlobalId
        {
            get;
            set;
        }

        /// <summary>
        /// Copies public data properties only and does not copy globalId
        /// </summary>
        /// <param name="data">source data object</param>
        /// <returns>current object</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="data"/> is <see langref="null"/></exception>
        IObjectData Copy(IObjectData data);

        /// <summary>
        /// Copies all data properties including globalId
        /// </summary>
        /// <param name="data">source data object</param>
        /// <exception cref="ArgumentNullException">If <paramref name="data"/> is <see langref="null"/></exception>
        /// <returns>current object</returns>
        IObjectData Init(IObjectData data);

        /// <summary>
        /// Clone : Creates a new object with same property values and same Global Id
        /// </summary>
        /// <returns>new object</returns>
        IObjectData Clone();

        /// <summary>
        /// Create : Creates a new empty instance of an object
        /// </summary>
        /// <returns>new object</returns>
        IObjectData CreateNewInstance();
    }
}
